import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/home',
    name: 'home',
    component: HomeView
  },
  {
    path: '/',
    redirect:'/home'
  },
  {
    path: '/list',
    name: 'List',
    component: () => import('@/views/ListView.vue')
  },
  {
    path: '/cart',
    name: 'Cart',
    component: () => import('@/views/CartView.vue')
  },
  {
    path: '/my',
    name: 'My',
    component: () => import('@/views/MyView.vue')
  },
  {
    path: '/searchIndex',
    name: 'SearchIndex',
    children:[
      {
        path: '/',
        name: 'search',
        component: () => import('@/views/search/Search.vue')
      },
      {
        path: 'list',
        name: 'list',
        component: () => import('@/views/search/SearchList.vue')
      }
    ],
    component: () => import('@/views/search/SearchIndex.vue')
  },

  {
    path: '/detail',
    name: 'Detail',
    component: () => import('@/views/DetailView.vue')
  },
  {
    path: '/login',
    name: 'login', 
    component: () => import('@/views/user/Login.vue')
  },
  {
    path: '/register',
    name: 'register', 
    component: () => import('@/views/user/Register.vue')
  },
  {
    path: '/order',
    name: 'order', 
    component: () => import('@/views/user/Order.vue')
  },
  {
    path: '/buyorder',
    name: 'buyorder', 
    component: () => import('@/views/user/BuyOrder.vue')
  },
  {
    path: '/orderList',
    name: 'orderList', 
    component: () => import('@/views/user/OrderList.vue')
  },
  
]

const router = new VueRouter({
  // mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
